<%@ page import="com.ljx.demo6.utils.DataBaseUtil" %>
<%@ page import="com.ljx.demo6.dao.NewsDao" %>
<%@ page import="java.sql.SQLException" %><%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2024-05-22
  Time: 15:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    Long id = Long.valueOf(request.getParameter("id"));
    try {
        boolean b = NewsDao.deleteNewsById(id);
        if (b){
            out.println("<script type=\"text/javascript\">");
            out.println("alert('删除成功');");
            out.println("window.location.href='admin.jsp';");
            out.println("</script>");
        } else {
            out.println("<script type=\"text/javascript\">");
            out.println("alert('删除出错');");
            out.println("window.location.href='admin.jsp';");
            out.println("</script>");
        }
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
%>
<html>
<head>
    <title>Title</title>
</head>
<body>

</body>
</html>
